package cn.lr.basic.util;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;

/**
 *
 * @author hm
 */
public class EmailUtil {

    private JavaMailSender javaMailSender;

    static {
        SpringUtils.getBean(org.springframework.mail.javamail.JavaMailSender.class);
    }
  public  void simpleEmail(String from,String to,String subject,String text){
      SimpleMailMessage mailMessage = new SimpleMailMessage();
      //设置发送人
      mailMessage.setFrom(from);
      //邮件主题
      mailMessage.setSubject(subject);
      //邮件内容
      mailMessage.setText(text);
      //收件人
      mailMessage.setTo(to);
      javaMailSender.send(mailMessage);
  }

}